package me.yobol.greentable.dao;

import java.sql.Connection;
import java.sql.Date;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;

import me.yobol.greentable.bean.UserBean;

/**
 * @author Yobol
 *
 */
public interface IUserDAO {
	
	public int save(Connection ctn,UserBean user) throws SQLException;
	
	public UserBean delete(Connection ctn,int userId) throws SQLException;
	
	public void update(Connection ctn,int userId,UserBean nUser) throws SQLException;
	public void updateName(Connection ctn,int userId,String name) throws SQLException;
	public void updatePassword(Connection ctn,int userId,String password) throws SQLException;
	public void updateGender(Connection ctn,int userId,String gender) throws SQLException;
	public void updateBirthday(Connection ctn,int userId,Date birthday) throws SQLException;
	public void updateEmail(Connection ctn,int userId,String email) throws SQLException;
	public void updateQQ(Connection ctn,int userId,String qq) throws SQLException;
	public void updatePhone(Connection ctn,int userId,String phone) throws SQLException;
	public void updateLatestLoginTime(Connection ctn,int userId,Timestamp latestLoginTime) throws SQLException;
	public void updateRoleId(Connection ctn,int userId,int roleId) throws SQLException;

	public UserBean get(Connection ctn,int userId) throws SQLException;
	public List<UserBean> getByName(Connection ctn,String name) throws SQLException;
	public List<UserBean> getByGender(Connection ctn,String gender) throws SQLException;
	public List<UserBean> getByBirthday(Connection ctn,Date birthday) throws SQLException;
	public List<UserBean> getByEmail(Connection ctn,String email) throws SQLException;
	public List<UserBean> getByQQ(Connection ctn,String qq) throws SQLException;
	public List<UserBean> getByPhone(Connection ctn,String phone) throws SQLException;
	public List<UserBean> getByRoleId(Connection ctn,int roleId) throws SQLException;
	
}
